import { useHistory, useParams } from "react-router-dom";

export default function Contact() {
  const params = useParams<{ id: string; name: string }>();

  const history = useHistory();

  const handleClick = () => {
    history.push({
      pathname: "/about",
      state: {
        id: 200,
        name: "玩古玩",
      },
    });
  };

  return (
    <div>
      <h2>Contact</h2>
      <p>Id: {params.id}</p>
      <p>Name: {params.name}</p>
      <button onClick={handleClick}>点我去 /about</button>
    </div>
  );
}
